/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cooperativa.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author giovanny
 */
@Entity
@Table(name = "historico_unidad")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoricoUnidad.findAll", query = "SELECT h FROM HistoricoUnidad h"),
    @NamedQuery(name = "HistoricoUnidad.findById", query = "SELECT h FROM HistoricoUnidad h WHERE h.id = :id"),
    @NamedQuery(name = "HistoricoUnidad.findByCreationDate", query = "SELECT h FROM HistoricoUnidad h WHERE h.creationDate = :creationDate"),
    @NamedQuery(name = "HistoricoUnidad.findByCreatedBy", query = "SELECT h FROM HistoricoUnidad h WHERE h.createdBy = :createdBy"),
    @NamedQuery(name = "HistoricoUnidad.findByLastUpdateDate", query = "SELECT h FROM HistoricoUnidad h WHERE h.lastUpdateDate = :lastUpdateDate"),
    @NamedQuery(name = "HistoricoUnidad.findByLastUpdateBy", query = "SELECT h FROM HistoricoUnidad h WHERE h.lastUpdateBy = :lastUpdateBy")})
public class HistoricoUnidad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "creation_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creationDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "created_by")
    private int createdBy;
    @Column(name = "last_update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdateDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "last_update_by")
    private int lastUpdateBy;
    @JoinColumn(name = "id_unidad", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Unidad idUnidad;
    @JoinColumn(name = "id_socio", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Socio idSocio;

    public HistoricoUnidad() {
    }

    public HistoricoUnidad(Integer id) {
        this.id = id;
    }

    public HistoricoUnidad(Integer id, Date creationDate, int createdBy, int lastUpdateBy) {
        this.id = id;
        this.creationDate = creationDate;
        this.createdBy = createdBy;
        this.lastUpdateBy = lastUpdateBy;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public int getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(int createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastUpdateDate() {
        return lastUpdateDate;
    }

    public void setLastUpdateDate(Date lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }

    public int getLastUpdateBy() {
        return lastUpdateBy;
    }

    public void setLastUpdateBy(int lastUpdateBy) {
        this.lastUpdateBy = lastUpdateBy;
    }

    public Unidad getIdUnidad() {
        return idUnidad;
    }

    public void setIdUnidad(Unidad idUnidad) {
        this.idUnidad = idUnidad;
    }

    public Socio getIdSocio() {
        return idSocio;
    }

    public void setIdSocio(Socio idSocio) {
        this.idSocio = idSocio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoricoUnidad)) {
            return false;
        }
        HistoricoUnidad other = (HistoricoUnidad) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cooperativa.entities.HistoricoUnidad[ id=" + id + " ]";
    }
    
}
